package o;

import android.content.Context;
import android.text.TextUtils;
import com.huawei.appgallery.datastorage.database.AbsDataDAO;
import com.huawei.appmarket.service.predownload.bean.UpdateConfigInfo;
import com.huawei.appmarket.service.predownload.database.BackgroundTaskDataBase;
import java.util.ArrayList;
import java.util.List;

public class edm extends AbsDataDAO {
    private static edm ˊ = null;
    private static final Object ˋ = new Object();

    public static synchronized edm ˏ(Context context) {
        edm o_edm;
        synchronized (edm.class) {
            synchronized (ˋ) {
                if (ˊ == null) {
                    ˊ = new edm(context);
                }
                o_edm = ˊ;
            }
        }
        return o_edm;
    }

    private edm(Context context) {
        super(context, BackgroundTaskDataBase.class, UpdateConfigInfo.class);
    }

    public List<String> ˎ() {
        List<String> arrayList = new ArrayList();
        for (UpdateConfigInfo updateConfigInfo : this.ˏ.ˏ(UpdateConfigInfo.class, null)) {
            if (!TextUtils.isEmpty(updateConfigInfo.packageName)) {
                arrayList.add(updateConfigInfo.packageName);
            }
        }
        return arrayList;
    }

    public void ˋ(List<String> list) {
        if (CollectCheck.isEmpty((List) list)) {
            Logger.ˎ("UpdateConfigDAO", "package list is empty, can not add to database");
            return;
        }
        ˋ();
        for (String str : list) {
            blw updateConfigInfo = new UpdateConfigInfo();
            updateConfigInfo.packageName = str;
            this.ˏ.ˊ(updateConfigInfo);
        }
    }

    public void ˋ() {
        this.ˏ.ˎ(null, null);
    }
}
